package Test;

import java.util.*;

public class TTT8 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int res = 0;
        int index = sc.nextInt();
        HashMap<Integer, Integer> map = new HashMap<>();
        List<Test> list = new ArrayList<>();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                arr[i] += sc.nextInt();
            }
        }
        for (int i = 0; i < n; i++) {
            list.add(new Test(i,arr[i]));
        }
        list.sort(Test::compareTo);
        System.out.println(list);
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).k == index - 1) {
                res = i + 1;
                break;
            }
        }
        System.out.println(res);
    }

    static class Test implements Comparable<Test> {
        int k;
        int v;
        public Test(int k, int v) {
            this.k = k;
            this.v = v;
        }
        @Override
        public int compareTo(Test o) {
            if (this.v == o.v) return this.k - o.k;
            return o.v - this.v;
        }

        @Override
        public String toString() {
            return "Test{" +
                    "k=" + k +
                    ", v=" + v +
                    '}';
        }
    }
}
